﻿// 文件路径：AyuBookmark.Common/Interfaces/IImageRepository.cs
using System.IO;
using System.Threading.Tasks;
using AyuBookmark.Common.Models;

namespace AyuBookmark.Common.Interfaces
{
    /// <summary>
    /// 图片资源仓库接口
    /// </summary>
    public interface IImageRepository : IRepository<Image, int>
    {

        Task<Image> GetByPathAsync(string path);

        /// <summary>
        /// 根据内容哈希获取图片
        /// </summary>
        Task<Image> GetByHashAsync(string contentHash);

        /// <summary>
        /// 保存图片文件到存储系统
        /// </summary>
        /// <param name="imageStream">图片流</param>
        /// <param name="fileExtension">文件扩展名</param>
        /// <returns>存储后的文件路径</returns>
        Task<string> SaveImageFileAsync(Stream imageStream, string fileExtension = ".jpg");

        /// <summary>
        /// 清理未被引用的图片资源
        /// </summary>
        //Task CleanupOrphanedImagesAsync();
        Task<int> CleanupOrphanedImagesAsync();
        
    }
}